import request from '@/utils/request'

// 获取全部已通过的社团公告
export function getClubNotify(data) {
  return request({
    url: '/api/club_announcement/',
    method: 'get',
    params: data
  })
}

// 根据角色获取公告
export function getClubNotifyByPerms(data) {
  return request({
    url: '/api/club_announcement/club_announcement/',
    method: 'get',
    params: data
  })
}

// 新建社团公告(会长)
export function createNotify(data) {
  return request({
    url: '/api/club_announcement/',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data: data
  })
}

// 新建社团公告(校团委)
export function createNotifyByXTW(data) {
  return request({
    url: '/api/club_announcement/create_announce/',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data: data
  })
}

// 更新社团公告
export function updateNotify(id, data) {
  return request({
    url: '/api/club_announcement/' + id + '/',
    method: 'patch',
    headers: {
      'Content-Type': 'application/json'
    },
    data: data
  })
}

// 删除社团公告
export function deleteNotify(id) {
  return request({
    url: '/api/club_announcement/' + id + '/',
    method: 'delete'
  })
}

// 获取社团公告详情
export function getNotifyDetail(id, data) {
  return request({
    url: '/api/club_announcement/' + id + '/',
    method: 'get',
    params: data
  })
}

// 获取社团公告一级审核列表
export function getFirstCheckNotify(data) {
  return request({
    url: '/api/club_announcement/first_check_list/',
    method: 'get',
    params: data
  })
}

// 获取社团公告二级审核列表
export function getSecondCheckNotify(data) {
  return request({
    url: '/api/club_announcement/second_check_list/',
    method: 'get',
    params: data
  })
}

// 进行一级审核
export function firstCheckNotify(id, data) {
  return request({
    url: '/api/club_announcement/' + id + '/first_check/',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data: data
  })
}

// 进行二级审核
export function secondCheckNotify(id, data) {
  return request({
    url: '/api/club_announcement/' + id + '/second_check/',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data: data
  })
}
